﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace ScrumTime.Helpers
{
    public class ScrumTimeAppConfig
    {
        private static string GetAppSettingValue(String key) {
            //String value = System.Configuration.ConfigurationSettings.AppSettings.Get(key);
            String value = System.Configuration.ConfigurationManager.AppSettings[key];
            if (string.IsNullOrEmpty(value))
            {
                throw new Exception("The application has not been configured correctly (" + key +").");
            }
            return value;
        }

        public static int GetUserId_Admin() {
            String AdminId = GetAppSettingValue("RolId_Admin");            
            return int.Parse(AdminId);
        }

        public static int GetUserId_ScrumMaster()
        {
            String AdminId = GetAppSettingValue("RolId_ScrumMaster");
            return int.Parse(AdminId);
        }

        public static int GetUserId_Developer()
        {
            String AdminId = GetAppSettingValue("RolId_Developer");
            return int.Parse(AdminId);
        }

        public static bool GetSetUserDefault()
        {
            String resultado = GetAppSettingValue("SetDefaultUser");
            return bool.Parse(resultado);
        }

    }
}